<?

	$postUrl = $this->getConfirmUrl();
	$shopUrl = $this->getShopUrl();
	$cartUrl = $this->getCartUrl();
	$submitUrl = $this->getSubmitUrl();
	
	//
	
 	$currency = $this->getCurrency();
 	$currencySign = $this->getCurrencySign();
 	
 	global $_SESSION;
 	//echo "session = <pre>";print_r($_SESSION['formDataForCart']);echo "</pre><br />";
 	
?>
<h1 class="sifr">Confirm your purchase</h1>
	
	
	
	
	<div id="confirmOrder">
	
	<h4>Your order:</h4>
<?

	foreach ($this->orderContainer->orderItems() as $oi) {
		//simple check
		if (is_null($oi) || $oi->valueForKey('isEmpty')) continue;

// this is tied in to the cms directly.. not choice.. should be tied in to the order item 
//		$product = $cmsDocument->openDocumentFromCache($oi->valueForKey('productId'));
//		$masterProduct = $cmsDocument->openDocumentFromCache($product->categorycode);
		//myPrintR($oi);
		
		// quantity
		$quantity = $oi->valueForKey('quantity');
		if (!is_null($quantity) && $quantity > 0 ) {
			$q = $quantity;
		} else {
			$q = 0;
		}
		
		$product = $oi->getProduct();
		
		//build a product url here
?>	
		<strong><?= $q ?> x <?php echo $product->title; echo $oi->valueForKey('productInvoiceDescription'); ?> </strong> @ <?= $currencySign . sprintf("%01.2f",$oi->valueForKey('price')) ." ".$currency; ?> <br />
		
<?

	// }
	}
?><p></p>
		<strong>Shipping Cost:</strong> <?php 
	      if($this->orderContainer->valueForKey("shippingPrice") == "TBA"){
	      	echo $this->orderContainer->valueForKey("shippingPrice");
	      } else {
		      echo $currencySign;
		      printf("%01.2f",  $this->orderContainer->valueForKey('shippingPrice'));
		      echo  " " . $currency;
	      }
	      
	       ?> <br />
		<strong>Total Cost:</strong> <?= $currencySign . sprintf("%01.2f",  $this->orderContainer->valueForKey('totalPrice')). " ".$currency; ?> <br />
	</div>
	
	
	
	<div id="confirmShipping">
	
		<h4>Your Details:</h4>
		<table width="90%" cellspacing="0" cellpadding="0">
  <tr>
    <td width="29%" align="right" class="tableCell"><strong>First name:</strong></td>
    <td width="71%" class="tableCellR"><?= $this->orderContainer->valueForKey('firstName') ?></td>
  </tr>
  <tr>
    <td align="right" class="tableCell"><strong>Last name:</strong></td>
    <td class="tableCellR"><?= $this->orderContainer->valueForKey('lastName') ?></td>
  </tr>
  <tr>
    <td align="right" class="tableCell"><strong>Email address:</strong></td>
    <td class="tableCellR"><?= $this->orderContainer->valueForKey('email') ?></td>
  </tr>
  
  <tr>
    <td align="right" class="tableCellB"><strong>Phone:</strong> </td>
    <td class="tableCellBR"><?= $this->orderContainer->valueForKey('phone') ?></td>
  </tr>


</table>

		 
<br /><br />


		
		<h4>Shipping Address:</h4>
		<table width="90%" cellspacing="0" cellpadding="0">
          <tr>
            <td align="left" class="tableCellR">
             
            
        <?= $this->orderContainer->valueForKey('street') ?><br />
		<? if($this->orderContainer->valueForKey('suburb') != ""){ echo $this->orderContainer->valueForKey('suburb') . "<br />"; } ?>
		
		<?= $this->orderContainer->valueForKey('city') ?><br />

		<? if($this->orderContainer->valueForKey('state') != ""){ echo $this->orderContainer->valueForKey('state') . "<br />"; } ?>

		<?= $this->orderContainer->valueForKey('zip') ?><br />

		<?=$this->orderContainer->valueForKey('countryAsISOCode');?>	



</td>
          </tr>
          <tr>
            <td align="left" class="tableCellBR">Comments: <?= $this->orderContainer->valueForKey('comments') ?></td>
          </tr>
        </table>
		
	</div>




<div class="divider"></div>	
					
					<div id="purchaseSubmit">
						<a href="<?= $cartUrl ?>"><img src="/images/cartEdit.gif" alt="Edit your order" /></a>&nbsp;&nbsp;
						<a href="<?= $submitUrl ?>"><img src="/images/cartSubmit.gif" alt="Submit Order" /></a> 
					</div>